<template>
  <div>
    <!-- 头部 -->
    <van-nav-bar
      title="黑马杂货店"
      :left-text="leftText"
      :right-text="rightText"
      :left-arrow="arrowBool"
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
  </div>
</template>

<script>
export default {
  props: {
    // 合法性校验
    leftText: {
      type:String,
      default: () => ""
    },
    rightText: {
      type:String,
      default: () => ""
    },
    arrowBool: {
      type:Boolean,
      default: () => true
    }
  },
  data() {
    return {};
  },
  created() {},
  methods: {
    onClickLeft() {
      // 返回上一页
      this.$router.go(-1);
    },
    onClickRight() {
      this.$emit('addGoods')
    }
  }
};
</script>

<style lang="less" scoped>
.van-nav-bar {
  width: 100%;
}
</style>